package com.hy.lightning.boot.web;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.hy.lightning.boot.web.servlet.bean.DefaultHttpServletRequest;

/**
 * HttpRequest 缓存类
 * @author root
 *
 */
public class HttpRequestCache {
	
	private static final Map<Object, DefaultHttpServletRequest> map = new ConcurrentHashMap<>();

	public static void setRequest(Object serviceObj, DefaultHttpServletRequest request) {
		map.put(serviceObj, request);
	}
	
	public static DefaultHttpServletRequest getRequest(Object serviceObj) {
		return map.get(serviceObj);
	}
	
	public static void close(Object serviceObj) {
		if(map.containsKey(serviceObj))
			map.remove(serviceObj);
	}
}
